<?php
  /* Product class for kunuki */
class Product extends database {                          
  var $details = "";                                       
  var $product_id;                                         /* product id */
  var $product_is_for;
  var $name = "name";                                      /* name of the product */
  var $title = "title";                                    /* title of the item */
  var $category;                                           /* innerwear, casual wear, formal wear */
  var $color;
  var $size;
  var $price;                                              /* price */
  var $discount;                                           /* discount in %, default is 0 */
  var $admin_id;
  var $status;
  var $show_the_product;                                   /* wheather or not to show the product */
  var $path;
  
  var $mysqlConn;
  var $database;  
  
	function __construct() {                                 /* Create the constructor of the class */
		$this->mysqlConn = parent::__construct();
	}

  function create_product()
	{
    parent::query("insert into product (`for`, `name`, `title`, `category`, `color`, `size`, `price`, `discount`, `added_on`, `added_by`, `status`, `show`, `is_deleted`, `path` )
                   values ('".$this->product_is_for."', '".$this->name."', '".$this->title."', '".$this->category."', '".$this->color."', '".$this->size."', '".$this->price."', '".$this->discount."', '".date('Y-m-d g:i:s')."', '".$this->admin_id."', '".$this->status."', '".$this->show_the_product."', '0', '".$this->path."')"); 
	}

	function get_product()
	{
    return parent::get_records("select * from product");
	}

	function get_product_where($where)
	{
    return parent::get_records("select * from product ".$where);
	}
  
  function get_product_with_category()
	{
    return parent::get_records("select * from product where category = '".$this->category."'");
	}
  
  function get_product_with_name()
	{
    return parent::get_records("select * from product where name = '".$this->name."'");
	}
}
?>